package com.rupertjones.globalcron.web.model;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.joda.time.DateTimeZone;

/**
 * <p>&copy Rupert Jones 2011,2012</p>
 *
 * @author rup
 */
public class FormTimezone {

    private DateTimeZone dateTimeZone;

    public FormTimezone(DateTimeZone dateTimeZone) {
        this.dateTimeZone = dateTimeZone;
    }

    public String getId() {
        return dateTimeZone.getID();
    }

    public String toString() {
        return getId();
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof FormTimezone)) {
           return false;
        }
        if (this == obj) {
           return true;
        }
        FormTimezone rhs = (FormTimezone) obj;
        return new EqualsBuilder().append(getId(), rhs.getId()).isEquals();
    }

    public int hashCode() {
        return new HashCodeBuilder(17, 37).append(getId()).toHashCode();
    }
}
